
----节点越多,越平均


local consistent = require 'consistent'

consistent.add_server({"192.168.2.151:5555","192.168.2.151:5556","192.168.2.151:5557","192.168.2.151:5558"})
--consistent.add_server({"192.168.2.151:5559","192.168.2.151:5560","192.168.2.151:5561","192.168.2.151:5562"})



local n1 = 0
local n2 = 0
local n3 = 0
local n4 = 0
for i =1,200 do 
    local ser = consistent.get_upstream(i)
    if ser == "192.168.2.151:5555" then
        n1 = n1 +1
    elseif ser == "192.168.2.151:5556" then
        n2 = n2 +1
    elseif ser == "192.168.2.151:5557" then
        n3 = n3 +1
    else
        n4 = n4 +1
    end
    print(i,ser)
end

print("n1",n1)
print("n2",n2)
print("n3",n3)
print("n4",n4)